package com.wangzhenyu.learn.test.designPattern

//备忘录模式


@Suppress("UNUSED")
object TMementoPattern {

    class Originator {

        var state: String? = null

        fun createMemento(): Memento {
            return Memento(state)
        }

        fun restoreMemento(memento: Memento?) {
            state = memento?.state
        }
    }

    class Memento(val state: String?)

    class Caretaker  {
        var memento: Memento? = null
    }
}





